package cn.bgs.service.impl;

import cn.bgs.dao.StudentMapper;
import cn.bgs.pojo.Areas;
import cn.bgs.pojo.Cities;
import cn.bgs.pojo.Provinces;
import cn.bgs.pojo.Student;
import cn.bgs.service.StudentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired private StudentMapper studentMapper;

    @Override
    public PageInfo<Student> findAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Student> list= studentMapper.findAll();

        PageInfo<Student> p=new PageInfo<>(list);
        return p;
    }

    @Override
    public int deleteByPrimaryKey(Integer stuId) {
       return studentMapper.deleteByPrimaryKey(stuId);
    }

    @Override
    public Student selectByPrimaryKey(Integer stuId) {
        return studentMapper.selectByPrimaryKey(stuId);
    }

    @Override
    public List<Provinces> findAllProcess() {
        return studentMapper.findAllProcess();
    }

    @Override
    public List<Areas> findAllAreas() {
        return studentMapper.findAllAreas();
    }

    @Override
    public List<Cities> findAllCities() {
        return studentMapper.findAllCities();
    }

    @Override
    public int updateByPrimaryKeySelective(Student record) {
        return studentMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int insertSelective(Student record) {
        return studentMapper.insertSelective(record);
    }

    @Override
    public PageInfo<Student> stuQuery(Integer pageNum, Integer pageSize, Student students) {
        PageHelper.startPage(pageNum,pageSize);
        List<Student> list= studentMapper.stuQuery(students);

        PageInfo<Student> p=new PageInfo<>(list);
        return p;
    }

}
